package com.nidu.demo.log.dto;

import com.nidu.demo.base.BaseTenantCO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.time.LocalDateTime;

/**
 * API接口访问日志客户端对象
 *
 * @author auto
 */
@Data
@Schema(description = "API接口访问日志客户端对象")
@EqualsAndHashCode(callSuper = true)
public class ApiAccessLogCO extends BaseTenantCO {

    @Schema(description = "主键ID", example = "1")
    private Long id;

    @Schema(description = "链路追踪编号", example = "trace_123456")
    private String traceId;

    @Schema(description = "用户编号", example = "1")
    private Long userId;

    @Schema(description = "用户类型", example = "1")
    private Integer userType;

    @Schema(description = "应用名", example = "cola-demo")
    private String applicationName;

    @Schema(description = "请求方法名", example = "POST")
    private String requestMethod;

    @Schema(description = "请求地址", example = "/api/user/add")
    private String requestUrl;

    @Schema(description = "请求参数", example = "{\"username\":\"admin\"}")
    private String requestParams;

    @Schema(description = "响应结果", example = "{\"code\":200}")
    private String responseBody;

    @Schema(description = "用户 IP", example = "192.168.1.1")
    private String userIp;

    @Schema(description = "浏览器 UA", example = "Mozilla/5.0")
    private String userAgent;

    @Schema(description = "操作模块", example = "用户管理")
    private String operateModule;

    @Schema(description = "操作名", example = "创建用户")
    private String operateName;

    @Schema(description = "操作分类", example = "1")
    private Integer operateType;

    @Schema(description = "开始请求时间", example = "2025-01-01 12:00:00")
    private LocalDateTime beginTime;

    @Schema(description = "结束请求时间", example = "2025-01-01 12:00:01")
    private LocalDateTime endTime;

    @Schema(description = "执行时长", example = "1000")
    private Integer duration;

    @Schema(description = "结果码", example = "200")
    private Integer resultCode;

    @Schema(description = "结果提示", example = "操作成功")
    private String resultMsg;

}
